package
{
	import com.gk.app.SYS;
	import com.gk.init.InitContext;
	
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;

	[SWF(width="760",height="600",backgroundColor="0xfefefe")]
	public class GameKing extends Sprite
	{
		public function GameKing()
		{
			if(stage){
				addToStage(null)
			}else{
				addEventListener(Event.ADDED_TO_STAGE,addToStage);
			}
		}
		private function addToStage(e:Event):void
		{
			if(Boolean(e)) removeEventListener(Event.ADDED_TO_STAGE,addToStage);
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			
		}
		
		public function setConfig(c:XML):void{
			if(String(c.plat) == "renren"){
				SYS.plat = SYS.PLAT_RENREN;
			}
			SYS.serverURL = String(c.serverUrl);
			var main:Sprite = new Sprite();
			addChild(main);
			
			var pop:Sprite = new Sprite();
			SYS.POP = pop;
			addChild(pop);
			
			new InitContext(main);
		}
	}
}